DESCRIPTION="A Partition Magic Clone"
HOMEPAGE="http://qtparted.sourceforge.net"
SRC_URI="mirror://sourceforge/${PN}/${PN}_${PV}-1.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86"
IUSE="X qt"

DEPEND=">=x11-libs/qt-3.0.3
        >=sys-apps/parted-1.6.3
		>=dev-libs/progsreiserfs-0.3.0.4
		>=sys-apps/ntfsprogs-1.7.1"

src_unpack() {
        unpack ${PN}_${PV}-1.tar.gz ; cd ${S}
}

src_compile() {
        cd ${S}; 
		./configure \
			--prefix=/usr \
			--bindir=/usr/bin \
			--sbindir=/usr/sbin \
			--datadir=/usr/share || die
			
        cp src/Makefile src/Makefile.orig
			sed -e "s:CFLAGS   = -pipe -Wall -W -g:CFLAGS   = ${CFLAGS} :" \
	            -e "s:CXXFLAGS = -pipe -Wall -W -g:CXXFLAGS = ${CXXFLAGS} :" \
				src/Makefile.orig > src/Makefile
		emake || die
}

src_install(){
		# It's better to not use make install, we are doing
		# the same work by hand, it's more safe - Quequero
		dodir /usr/share/qtparted
		dodir /usr/share/qtparted/locale
		dodir /usr/share/pixmaps
		dodir /usr/share/applnk
		dodir /usr/share/applnk/System
		dosbin src/qtparted
		dosbin bin/qtparted_df
		insinto /usr/share/qtparted/locale
		doins src/ts/*qm
		insinto /usr/share/pixmaps
		doins image/qtparted.xpm
		insinto /usr/share/applnk/System
		doins menu/qtparted.desktop
}

pkg_postinst(){
	# Erm, some indications to users ;p - Quequero
	einfo "Don't worry if QTParted is slow to start, this is"
	einfo "because it needs to scan your disks, and also don't"
	einfo "worry if it seems freezed during operations, it's"
	einfo "only working :)"
}
